<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:custom="http://faces.componete/jsf"
      xmlns:rich="http://richfaces.org/rich"
      xmlns:a4j="http://richfaces.org/a4j">
    <link href="./css/default.css" rel="stylesheet" type="text/css" />
    
    <body>        
        <ui:composition template="./Template.xhtml">
            <ui:param name="title" value="Lista de Fornecedores"/>
            <ui:define name="content">
                <h:form>
                    <table>
                        <tr>
                            <td>
                                <fieldset class="campos">
                                    <legend class="news">Selecione:</legend>

                                    <h:selectOneRadio id="tipoConsulta" layout="pageDirection" value="#{FornecedorBo.tipoConsulta}">
                                        <f:selectItem itemLabel="Código" itemValue="cod" />
                                        <f:selectItem itemLabel="CNPJ/CPF" itemValue="cpf" />
                                        <f:selectItem itemLabel="Nome" itemValue="nome" />
                                        <f:selectItem itemLabel="Fantasia" itemValue="fantasia" />

                                    </h:selectOneRadio>

                                </fieldset>
                            </td>
                            <td>
                                <fieldset class="campos">
                                    <legend class="news">Dados da pesquisa:::</legend>
                                    <table width="99%" align="center" border="0">
                                        <tr>
                                            <td class="label">Conteúdo:</td>
                                            <td><h:inputText  value="#{FornecedorBo.valConsulta}" styleClass="textFieldEscritas" id="Descricao" maxlength="50"/>  </td>
                                        </tr>
                                        <tr>
                                            <br/>
                                            <br/>
                                            <td>
                                            </td>
                                            <td><h:messages/>
                                                <h:commandButton accesskey="P" styleClass="button" value="Pesquisar" action="#{FornecedorBo.consult_Fornecedor}" />&#160;&#160;
                                                <h:commandButton accesskey="L" styleClass="button" value="Limpar" action="#{FornecedorBo.limparCons}"/>&#160;&#160;
                                                <h:commandButton accesskey="V" styleClass="button" value="Voltar" action="#{FornecedorBo.addFornecedor}"/>&#160;&#160;
                                            </td>
                                            <br/>
                                        </tr>
                                    </table>
                                </fieldset>
                            </td>
                        </tr>
                    </table>
                    <rich:dataTable value="#{FornecedorBo.fornecedorTo}" var="item" width="700px" rowClasses="classeOne,classTwo" columnClasses="center"
                                    rows="10" reRender="ds">
                        <f:facet name="header">
                            <h:outputText value="Lista de Fornecedores"/>
                        </f:facet>
                        <rich:column sortBy="#{item.codCliente}">
                            <f:facet name="header">
                                <h:outputText value="Código"/>
                            </f:facet>
                            <h:outputText value="#{item.codCliente}"/>
                        </rich:column>
                        <rich:column sortBy="#{item.nome}">
                            <f:facet name="header">
                                <h:outputText value="Nome"/>
                            </f:facet>
                            <h:outputText value="#{item.nome}"/>
                        </rich:column>
                        <rich:column sortBy="#{item.nomeFantasia}">
                            <f:facet name="header">
                                <h:outputText value="Nome Fantasia"/>
                            </f:facet>
                            <h:outputText value="#{item.nomeFantasia}"/>
                        </rich:column>
                        <rich:column sortBy="#{item.cpfCnpj}">
                            <f:facet name="header">
                                <h:outputText value="CPF/CNPJ"/>
                            </f:facet>
                            <h:outputText value="#{item.cpfCnpj}"/>
                        </rich:column>

                        <rich:column>
                            <f:facet name="header">
                                <h:outputText value="Ações"/>
                            </f:facet>

                            <h:commandButton rendered="#{FornecedorBo.rederBotaoAlterar}" value= "Alterar" accesskey="A" styleClass="button" action="#{FornecedorBo.iniciaEditFornecedor}" >
                                <f:setPropertyActionListener target="#{FornecedorBo.selectFornecedor}" value="#{item}"/>
                            </h:commandButton>

                            <h:commandButton rendered="#{MovimentacaoFinanceiraBo.botaoSeleciona}" value= "Seleciona" accesskey="S" styleClass="button"  action="#{MovimentacaoFinanceiraBo.selecionaClienteFornecedor}" >
                                <f:setPropertyActionListener target="#{MovimentacaoFinanceiraBo.selectMovFinanceira.clienteFornecedor}" value="#{item}"/>
                            </h:commandButton>
                            
                            <h:commandButton rendered="#{ContasPagarReceberBo.botaoSeleciona}" value= "Seleciona" accesskey="S" styleClass="button"  action="#{ContasPagarReceberBo.selecionaClienteFornecedor}" >
                                <f:setPropertyActionListener target="#{ContasPagarReceberBo.selectContasPagarReceber.clienteFornec}" value="#{item}"/>
                            </h:commandButton>

                        </rich:column>
                        <f:facet name="footer">
                            <rich:datascroller id="ds"></rich:datascroller>
                        </f:facet>
                    </rich:dataTable>

                </h:form>
            </ui:define>
        </ui:composition>
        
    </body>
</html>
